/*
 * This file is part of TimeCounter.
 * A static non-reentrant library which acts as interface
 * to the high-resolution hardware counter.
 * Copyright (C) 2013 Giulio Franco
 *         
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef TIME_MGMT_H_INCLUDED
#define TIME_MGMT_H_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Fetches HPC timer resolution
 * @param	out	output	The inter-tick time will be stored here
 * @returns				1 if succeeded, 0 in case of errors
 */
int timer_resolution(double* output);

/**
 * Performs a tick and fetches the time between it and the last one
 * @param	out	output	Time between this tick and the last one
 * @returns				1 if succeeded, 0 in case of errors
 */
int tick_and_get_f(float* output);

/**
 * Performs a tick and fetches the time between it and the last one
 * @param	out	output	Time between this tick and the last one
 * @returns				1 if succeeded, 0 in case of errors
 */
int tick_and_get_d(double* output);

/**
 * Performs a tick
 * @returns				1 if succeeded, 0 in case of errors
 */
int tick();


#ifdef __cplusplus
}
#endif

#endif // TIME_MGMT_H_INCLUDED
